package com.guomei.utils;

import com.guomei.constans.ResultCode;
import lombok.Data;

@Data
public class PageResult<T> extends Result<T>{
    private long total; // 总条数
    private int pageSize; // 每页条数
    private int pageNum; // 当前页码

    public static <T> PageResult<T> success(T data, long total, int pageSize, int pageNum) {
        PageResult<T> result = new PageResult<>();
        result.setCode(ResultCode.SUCCESS.getCode());
        result.setMsg(ResultCode.SUCCESS.getMsg());
        result.setData(data);
        result.setTotal(total);
        result.setPageSize(pageSize);
        result.setPageNum(pageNum);
        return result;
    }
}
